home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / Newton Sample Code 1.1 / Views / Strange Changes-2 / Changes.text < prev    next >
Encoding:
Text File  |  1994-03-08  |  3.5 KB  |  112 lines  |  [TEXT/MPS ]

  1. // © Copyright 1993-94 Apple Computer, Inc, All Rights Reserved
  2.  
  3. constant kAppName := '|Changes:PIEDTS|;
  4.  
  5. // ---- End Project Data ----
  6.  
  7.  
  8. // ---- File Changes.t ----
  9. baseView :=
  10.    {title: "clEditView Workaround",
  11.     viewBounds: {left: -4, top: 8, right: 228, bottom: 304},
  12.     viewSetupFormScript:
  13.       func()
  14.       begin
  15.           constant kMaxAppWidth := 240 ; // original MP width
  16.           constant kMaxAppHeight:= 336 ; // original MP height
  17.       
  18.           local b := GetAppParams() ;
  19.           // make view no bigger than the original MP
  20.           viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
  21.                       MIN(b.appAreaWidth, kMaxAppWidth),
  22.                       MIN(b.appAreaHeight, kMaxAppHeight));
  23.       end,
  24.     _proto: protoApp,
  25.     debug: "baseView"
  26.    };
  27.  
  28. myEditView := /* child of baseView */
  29.    {viewFlags: 33553921,
  30.     viewFormat: 337,
  31.     viewBounds: {left: 35, top: 27, right: 203, bottom: 211},
  32.     viewChangedScript:
  33.       func(slot, view)
  34.       begin
  35.            print("myEditView:viewChangedScript()");
  36.           nil;
  37.       end,
  38.     viewClickScript:
  39.       func(unit)
  40.       begin
  41.            print("myEditView:viewClickScript()");
  42.            return nil;
  43.       end,
  44.     viewDropChildScript:
  45.       func(oldOne)
  46.       begin
  47.            print("myEditView:viewDropChildScript()");
  48.       //This should return TRUE if you manually removed the child
  49.       end,
  50.     viewAddChildScript:
  51.       //Sample code copyright 1994, Apple Computer Inc.
  52.       //Written by Todd Courtois
  53.       
  54.       func(newOne)
  55.       begin
  56.       
  57.          if (newOne.viewStationery = 'poly) then  //it's a clPolygonView
  58.          begin
  59.            newOne.oldSum := 0; //Create an oldSum slot in this new clPolygonView
  60.            newOne.viewFlags := vVisible + vClickable;
  61.            //Need to adjust viewFlags so that you can click on this particular clPolygonView
  62.       
  63.       
  64.          //This is where we slap a viewClickScript onto the barebones clPolygonView
  65.            newOne.viewClickScript := func(unit)
  66.            begin
  67.                 oldSum := 0; //reset our cheezy checksum
  68.                 //Now, do a quick sum over the view's "points" binary object
  69.                 for i := 0 to (Length(points) -1 ) do oldSum := oldSum + (i*2)*ExtractByte(points,i);
  70.                 print(oldsum);
  71.       
  72.                 //Now, come back and look at this view again when you're done clicking
  73.                 AddDeferredAction( 
  74.                   func(oldSum)
  75.                     begin
  76.                         local mySum := 0;
  77.                          //Again, get a quick sum over the new points object
  78.                         for i := 0 to (Length(points) -1) do mySum := mySum + (i*2)*ExtractByte(points,i);
  79.                         print(mysum);
  80.                         //Now compare oldSum and newSum as a cheezy checksum
  81.                         if (mySum <> oldSum) then myEditView:viewChangedScript(viewChildren,myEditView);
  82.                          
  83.                    end, [oldsum]);
  84.       
  85.            return nil; //we didn't really handle the click; pass it up
  86.            end;
  87.          end;
  88.       
  89.          print("myEditView:viewAddChildScript()");
  90.       
  91.       return nil;
  92.       //This should return TRUE if you manually added the child
  93.       end,
  94.     viewGestureScript:
  95.       func(unit, gestureID)
  96.       begin
  97.            print("myEditView:viewGestureScript()");
  98.       end,
  99.     viewclass: 77,
  100.     debug: "myEditView"
  101.    };
  102. // View myEditView is declared to baseView
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. // ---- Beginning of section for non used Layout files ----
  111.  
  112. // End of output